Skip to content

Conversation

christianbeeznest
Copy link
Contributor

No description provided.

$feature = api_detect_feature_context();
$permission = $feature.':edit';

return api_get_permission($permission, $userRoles);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid too many return statements within this method.

return api_get_permission($permission, $userRoles);
}

return $isAllowed;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid too many return statements within this method.

Copy link
Member

@ywarnier ywarnier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small change required for efficiency.

Copy link

Code Climate has analyzed commit 20b053a and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 2

View more on Code Climate.

Copy link
Member

@ywarnier ywarnier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change requested for the display of user roles

$status_options
'keyword_roles',
get_lang('Roles'),
array_combine(api_get_roles(), api_get_roles()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The select input should show the roles by their translated values.
The translated variables are as follow:

  • ROLE_STUDENT: Learner
  • ROLE_ADMIN: Admin
  • ROLE_SUPER_ADMIN: Super admin
  • ROLE_GLOBAL_ADMIN: Global admin
  • ROLE_TEACHER: Teacher
  • ROLE_HR: Human Resources Manager
  • ROLE_QUESTION_MANAGER: Question manager
  • ROLE_SESSION_MANAGER: Session administrator
  • ROLE_STUDENT_BOSS: Superior (n+1)
  • ROLE_INVITEE: Invitee

Considering we do not have such a "translations" table for roles, I would put that directly (hardcoded) into the api_get_roles() function. We will take care of that in C3.

Just a note for myself: a global admin is the person who initially installed the system (just a detail vs the super admin, which is the person managing all URLs in a multi-URL context).

@ywarnier
Copy link
Member

@christianbeeznest aquí falta mostrar los roles en su versión traducida y corregir el conflicto de merge

@christianbeeznest
Copy link
Contributor Author

@christianbeeznest aquí falta mostrar los roles en su versión traducida y corregir el conflicto de merge

Esta agregado las traducciones y corregido los conflictos.

@ywarnier ywarnier merged commit 5586e06 into chamilo:master Sep 6, 2025
2 of 7 checks passed
@ywarnier
Copy link
Member

ywarnier commented Sep 6, 2025

Confirmed together with @christianbeeznest that this is an elegant way to transition from legacy-permissions (only about 13 roles, most mutually-exclusive) to a new system of combination of roles that have given permissions each.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants